<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
		<html>
		<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
		<title>DBIRecord</title>
		<META HTTP-EQUIV="EXPIRES" CONTENT=0>
		<link rel="stylesheet" href="../../../../docs.css">
		</head>
		<body>
		
<br>
<h1>Io Reference</h1>
<br><br><br>
<br><br><br>
<a class='column' href='../../index.html'>Databases</a>
&nbsp;&nbsp;<font color=#ccc>/</font>&nbsp;&nbsp;
<a class='column' href='../index.html'>DBI</a>
&nbsp;&nbsp;<font color=#ccc>/</font>&nbsp;&nbsp;
<b>DBIRecord</b>
<br><br><br>
<br><br><br>
<table border=0 cellspacing=0 style="margin-left:8em; width:40em; line-height:1.2em;">
<tr>
<td align=right></td>
<td></td>
<td>A DBI Record. When utilizing `foreach' or `populate' methods
of a DBIResult object, you can pass an optional Object cloned from DBIRecord.
This object will be populated with the row contents making it possible to
write objects that represent your SQL results. A simple example would be:

<pre>
Person := DBIRecord clone do (fullName := method(firstName.." "..lastName))
q := conn query("SELECT id, firstName, lastName FROM people")
q foreach(Person, p, writeln("Name = ", p fullName))
</pre>

As you can see, fullName was not in the SQL query, however, a dynamic method
in your Person class.

DBIRecord in and of itself provides no real functionality. It simply acts
as an Object and stores the values from the SQL query into a Map. You can
access the field information:

<pre>
o := r populate(Person)
o firstName            // would retrieve the firstName value of the SQL query
o setFirstName("John") // would update the object's firstName value to be John
</pre>

Do not confuse the above example as updating the actual database. The call
to setFirstName <i>only</i> updates the objects representation of firstName.
</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr>
<td align=right>
</td>
<td></td>
<td>
<hr align=left color=#ddd height=1>
<br><br>
<font color=#888>
<a name="DBIRecord-forward"></a><b>
forward
</b>
<p>
<div class=slotDescription>
Private method that implements getting and setting values.
</font>
</div>
<a name="DBIRecord-with"></a><b>
with(aMap)
</b>
<p>
<div class=slotDescription>
Returns a new DBIRecord instance for the given value map.
</div>
</td>
</tr>
</table>
<br><br><br><br><br>
</body>
</html>
